//
//  BLTimeAxisBaseLine.m
//  BLTimeAxis
//
//  Created by dg on 2025/4/17.
//

#import "BLTimeAxisBaseLine.h"

@implementation BLTimeAxisBaseLine

- (void)acceptVisitor:(id<BLTimeAxisVisitor>)visitor {
    [visitor visitTimeAxisBaseLine:self];
}

- (void)setCurrentScale:(CGFloat)currentScale {
    [self updateToOptimisticScale:&currentScale];
    _currentScale = currentScale;
}

- (CGFloat)aSecondOfPixelWithViewWidth:(CGFloat)width {
    return ((width/_oneToOneScaleMatchMaxHoursInVisible)*_currentScale)/3600.0;
}

- (void)updateToOptimisticScale:(CGFloat *)scale {
    if (*scale < _minimumScale) {
        *scale = _minimumScale;
    } else if (*scale > _maximumScale) {
        *scale = _maximumScale;
    }
}

@end
